package com.just.recruitback.entity;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author baibaiwuchang
 * @since 2020-07-02
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Job implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 公司id
     */
    private Integer companyId;

    /**
     * 标题
     */
    private String title;

    /**
     * 地址
     */
    private String url;

    /**
     * 工作类型
     */
    private String type;

    /**
     * 教育要求
     */
    private String edu;

    /**
     * 福利
     */
    private String walfare;

    /**
     * 工资
     */
    private String salary;


    /**
     * 全职|实习
     */
    private String empltype;

    /**
     * 城市
     */
    private String city;

    /**
     * 工作年份
     */
    private String workYear;

    /**
     * 工作地址
     */
    private String address;

    /**
     * 概述
     */
    private String content;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    @TableField(exist = false)
    private Company company;

    public static Job zhilianConvertToJob(Zhilian zhilian, int companyId) {
        return new Job().setCompanyId(companyId)
                .setTitle(zhilian.getJobName())
                .setUrl(zhilian.getUrl())
                .setType(zhilian.getJobType())
                .setEdu(zhilian.getEdu())
                .setSalary(zhilian.getSalary())
                .setWalfare(zhilian.getWalfare())
                .setEmpltype(zhilian.getEmpltype())
                .setCity(zhilian.getCity())
                .setWorkYear(zhilian.getWorkingexp())
                .setAddress(zhilian.getWorkPlace())
                .setContent(zhilian.getRequireContent())
                .setCreateTime(LocalDateTime.now());
    }
}
